package me.jessyan.mvparms.demo.mvp.ui.activity;


import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.IntentFilter;

import android.util.DisplayMetrics;
import android.util.Log;

import com.jess.arms.base.BaseApplication;
import com.pgyer.pgyersdk.PgyerSDKManager;

import me.jessyan.mvparms.demo.mvp.ui.xunfeisdk.SpeechLib;


/**
 * Created by wangweitong on 2018/1/26.
 */
public class MainApplication extends BaseApplication {
    public String TAG = "lzd";

    public static Context mContext;
    /**
     * 屏幕宽度
     */
    public static int screenWidth;
    /**
     * 屏幕高度
     */
    public static int screenHeight;
    /**
     * 屏幕密度
     */
    public static float screenDensity;

    public static BluetoothSocket bluetoothSocket;

    private static MainApplication instance;
    public static  MainApplication getInstance(){
        if (instance == null) {
            synchronized( MainApplication.class) {
                MainApplication inst = instance;
                if (inst == null) {
                    synchronized(MainApplication.class) {
                        instance = new  MainApplication();
                    }
                }
            }
        }
        return instance;
    }


    @Override
    public void onCreate() {
        super.onCreate();

        IntentFilter filter = new IntentFilter();
        initScreenSize();
        Log.i("lzd","初始化科大讯飞");
        SpeechLib.init(this,"9a0faeb7");
        initPgyerSDK(this);
//        SpeechLib.init(this,"5fe9386f");


    }


    /**
     *  初始化蒲公英SDK
     */
    private static void initPgyerSDK(BaseApplication application){
        new PgyerSDKManager.Init()
                .setContext(application) //设置上下问对象
                .start();
    }

    /**
     * 初始化当前设备屏幕宽高
     */
    private void initScreenSize() {
        DisplayMetrics curMetrics = getApplicationContext().getResources().getDisplayMetrics();
        screenWidth = curMetrics.widthPixels;
        screenHeight = curMetrics.heightPixels;
        screenDensity = curMetrics.density;
    }



}
